Public Class NAmonestaciones
    Public Function cargarAmonestaciones(ByVal alumno As Entidades.EAlumno, ByVal list As List(Of Entidades.EAmonestacion)) As Boolean
        'utiliza la capa de datos
        Dim oDatos As New Datos.DAmonestaciones
        Dim band As Boolean
        Try
            For Each amonestacion As Entidades.EAmonestacion In list
                If oDatos.buscarAmonestacionPorAlumno(alumno, list) Then
                    MsgBox("Al alumno legajo: " & alumno.Num_Legajo & " en la fecha : " & amonestacion.fecha & "ya se le han cargado las amonestaciones", MsgBoxStyle.Information)
                    band = False
                    Exit Try
                End If
            Next
            band = oDatos.cargarAmonestaciones(alumno, list)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function

    Public Function modificarAmonestaciones(ByVal legajo As Integer, ByVal lista As List(Of Entidades.EAmonestacion)) As Boolean
        'utiliza la capa de datos
        Dim oDatos As New Datos.DAmonestaciones
        Dim band As Boolean
        Try
            band = oDatos.modificarAmonestacion(legajo, lista)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function

    Public Function borrarAmonestacion(ByVal legajo As Integer, ByVal lista As List(Of Entidades.EAmonestacion)) As Boolean
        'utiliza la capa de datos
        Dim oDatos As New Datos.DAmonestaciones
        Dim band As Boolean
        Try
            band = oDatos.borrarAmonestacion(legajo, lista)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function

    Public Function buscarAmonestacionesPorAlumno(ByVal legajo As Integer, ByVal fecha As Date) As Entidades.EAmonestacion

        Dim oDatos As New Datos.DAmonestaciones
        Try
            Return oDatos.buscarAmonestacionesPorAlumno(legajo, fecha)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
    End Function
    Public Function buscarAmonestacionesPorAlumno1(ByVal legajo As Integer) As List(Of Entidades.EAmonestacion)

        Dim oDatos As New Datos.DAmonestaciones
        Try
            Return oDatos.buscarAmonestacionesPorAlumno1(legajo)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
    End Function

    Public Function buscarAmonestacionPorAlumno(ByVal alumno As Entidades.EAlumno, ByVal lista As List(Of Entidades.EAmonestacion)) As Boolean
        Dim oDatos As New Datos.DAmonestaciones
        Dim band As Boolean
        Try
            For Each amonestacion As Entidades.EAmonestacion In lista
                If oDatos.buscarAmonestacionPorAlumno(alumno, lista) Then
                    band = True
                    Exit Try
                End If
                band = False
                Exit Try
            Next
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function

    Public Function buscarAmonestacionesPorTrimestre(ByVal legajo As Integer, ByVal trim As Integer, ByVal ciclo As Integer) As List(Of Entidades.EAmonestacion)

        Dim oDatos As New Datos.DAmonestaciones
        Try
            Return oDatos.buscarAmonestacionPorTrimestre(legajo, trim, ciclo)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
    End Function
End Class
